﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StudentData
{
    enum Specialties { KN, Softuerno, Informacionni, Informatika }
    enum Universities { UNSS, SU }
    enum Faculties { FMI, UF, IF }

    class Student : ICloneable, IComparable 
    {
        /*
         * Define a class Student,
         * which contains data  about 
         * a student – three names, SSN, 
         * permanent address, mobile phone
         * e-mail, course, specialty, university, faculty. 
         */

        string names;
        string SSN;
        string address;
        string mobileNumber;
        string cource;
        Specialties specialty;
        Universities university;
        Faculties faculty;

        public Student(string names, string SSN, string address, string mobileNumber, string course, Specialties spec,
            Universities uni, Faculties fac)
        {
            this.names = names;
            this.SSN = SSN;
            this.address = address;
            this.mobileNumber = mobileNumber;
            this.cource = course;
            this.specialty = spec;
        }


        public override bool Equals(object obj)
        {
            Student student = obj as Student;
            int result = this.names.CompareTo(student.names);
            if (result == 0)
            {
                result = this.SSN.CompareTo(student.SSN);
            }
            if (result == 0)
            {
                result = this.address.CompareTo(student.address);
            }
            if (result == 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public override string ToString()
        {
            string toString = this.names + " " + this.faculty + " " + this.address + " " + this.cource + " " + this.faculty;
            return toString;
        }

        public override int GetHashCode()
        {
            return this.names.GetHashCode() ^ this.specialty.GetHashCode() + this.specialty.GetHashCode();
        }

        public static bool operator ==(Student student1, Student student2)
        {
            return student1.Equals(student2);
        }

        public static bool operator !=(Student student1, Student student2)
        {
            return !student1.Equals(student2);
        }

        public Student Clone()
        {
            Student cloned = new Student(this.names, this.SSN, this.address, this.mobileNumber, this.cource,
                this.specialty, this.university, this.faculty);
            return cloned;
        }

        object ICloneable.Clone()
        {
            return this.Clone();
        }

        public int CompareTo(object obj)
        {
            Student other = obj as Student;
            int result = this.names.CompareTo(other.names);
            if (result == 0)
            {
                result = this.SSN.CompareTo(other.SSN);
            }
            return result;
        }
    }
}